/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ejemplocoleccionvector;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author AdminLocal
 */
public class ClaseGenerica <T extends InfoPalabra> {
    ArrayList<T> variable;

    public ClaseGenerica()
    {
        variable = null;
    }
    public ClaseGenerica(T valor)
    {
        variable.add(valor);
    }

    public void serializar()
    {
        ObjectOutputStream salida=null;
        try
        {
            salida = new ObjectOutputStream(new FileOutputStream("fichero.txt"));
            salida.writeObject(variable);
        } catch (FileNotFoundException ex)
        {
            Logger.getLogger(ClaseGenerica.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex)
        {
            Logger.getLogger(ClaseGenerica.class.getName()).log(Level.SEVERE, null, ex);
        }
        finally
        {
            try
            {
                salida.close();
            } catch (IOException ex)
            {
                Logger.getLogger(ClaseGenerica.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }

}
